package com.itlong.cloud.commons.resource;

import com.itlong.cloud.POJO.DTO.operate.UploadImageDTO;
import com.itlong.cloud.commons.service.IUploadImageService;
import com.itlong.cloud.noncore.commons.IUploadImageServiceClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * <desc>
 *     上传图片到图片服务器公共模块接口暴露实现。
 * <desc/>
 *
 * @createDate 2017/10/17.
 */
@RestController
public class UploadImageServiceResource implements IUploadImageServiceClient{

    @Autowired
    IUploadImageService iUploadImageService;

    /**
     * <desc>
     *      上传图片资源。
     * <desc/>
     *
     * @param  saveDTO 图片资源对象
     * @return  返回图片链接地址
     * @author shengen.T
     * @createDate 2017/10/20
     */
    @Override
    @RequestMapping(path="/uploadImg",method = {RequestMethod.POST})
    public String uploadImg(@RequestBody UploadImageDTO saveDTO) throws Exception{
        return iUploadImageService.uploadImage(saveDTO);
    }
}
